layui.use(['form', 'layer', 'laydate', 'jquery', 'upload'], function() {
				var form = layui.form;
				var layer = layui.layer;
				var laydate = layui.laydate;
				var $ = layui.jquery;
				var upload = layui.upload;
				// var date = new Date();

				//执行一个laydate实例
				laydate.render({
					elem: '#timeOne', //指定元素
					min: "7:00:00",
					max: "20:59:59",
					type: 'time',
					format: 'yyyy-MM-dd HH:mm:ss'
				});
				
			//这是判断是拍卖还是正常交易
			form.on('radio(aaa)', function (data) {
				if ($('#IsPurchased input[name="t"]:checked ').val() == "1") {
				    $(".count").hide();
				}
				else {
				    $(".count").show();
				}
				form.render();
				});
				
				
				//普通图片上传1
				var uploadInst = upload.render({
					elem: '#uptest1',
					url: '/upload/',
					accept: 'images',
					size: 800,
					before: function(obj) {

						obj.preview(function(index, file, result) {
							$('#updemo1').attr('src', result);
							// document.getElementById("btn1").disabled=true;
						});
						
					},
					done: function(res) {
						//如果上传失败
						if (res.code > 0) {
							return layer.msg('上传失败');
						}
						//上传成功
						var demoText = $('#updemoText1');
						updemoText1.html('<span style="color: #4cae4c;">上传成功</span>');

						var fileupload = $(".image");
						fileupload.attr("value", res.data.src);
						console.log(fileupload.attr("value"));
					},
					// error: function() {
					// 	//演示失败状态，并实现重传
					// 	var demoText = $('#demoText');
					// 	demoText.html(
					// 		'<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
					// 	demoText.find('.demo-reload').on('click', function() {
					// 		uploadInst.upload();
					// 	});
					// }
				 });
				
				//普通图片上传2
				var uploadInst = upload.render({
					elem: '#uptest2',
					url: '/upload/',
					accept: 'images',
					size: 800,
					before: function(obj) {
				
						obj.preview(function(index, file, result) {
							$('#updemo2').attr('src', result);
							$("#uptest3").removeAttr('disabled');
							document.getElementById("uptest3").innerHTML="上传图片3";
						});
						
					},
					done: function(res) {
						//如果上传失败
						if (res.code > 0) {
							return layer.msg('上传失败');
						}
						//上传成功
						var demoText = $('#updemoText2');
						updemoText2.html('<span style="color: #4cae4c;">上传成功</span>');
				
						var fileupload = $(".image");
						fileupload.attr("value", res.data.src);
						console.log(fileupload.attr("value"));
					},
					// error: function() {
					// 	//演示失败状态，并实现重传
					// 	var demoText = $('#demoText');
					// 	demoText.html(
					// 		'<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
					// 	demoText.find('.demo-reload').on('click', function() {
					// 		uploadInst.upload();
					// 	});
					// }
				});
				
				//普通图片上传3
				var uploadInst = upload.render({
					elem: '#uptest3',
					url: '/upload/',
					accept: 'images',
					size: 800,
					before: function(obj) {
				
						obj.preview(function(index, file, result) {
							$('#updemo3').attr('src', result);
							$("#uptest4").removeAttr('disabled');
							document.getElementById("uptest4").innerHTML="上传图片4";
						});
						
					},
					done: function(res) {
						//如果上传失败
						if (res.code > 0) {
							return layer.msg('上传失败');
						}
						//上传成功
						var demoText = $('#updemoText3');
						updemoText3.html('<span style="color: #4cae4c;">上传成功</span>');
				
						var fileupload = $(".image");
						fileupload.attr("value", res.data.src);
						console.log(fileupload.attr("value"));
					},
					// error: function() {
					// 	//演示失败状态，并实现重传
					// 	var demoText = $('#demoText');
					// 	demoText.html(
					// 		'<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
					// 	demoText.find('.demo-reload').on('click', function() {
					// 		uploadInst.upload();
					// 	});
					// }
				});
				
				//普通图片上传4
				var uploadInst = upload.render({
					elem: '#uptest4',
					url: '/upload/',
					accept: 'images',
					size: 800,
					before: function(obj) {
				
						obj.preview(function(index, file, result) {
							$('#updemo4').attr('src', result);
						});
						
					},
					done: function(res) {
						//如果上传失败
						if (res.code > 0) {
							return layer.msg('上传失败');
						}
						//上传成功
						var demoText = $('#updemoText4');
						updemoText4.html('<span style="color: #4cae4c;">上传成功</span>');
				
						var fileupload = $(".image");
						fileupload.attr("value", res.data.src);
						console.log(fileupload.attr("value"));
					},
					// error: function() {
					// 	//演示失败状态，并实现重传
					// 	var demoText = $('#demoText');
					// 	demoText.html(
					// 		'<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
					// 	demoText.find('.demo-reload').on('click', function() {
					// 		uploadInst.upload();
					// 	});
					// }
				});

				//监听提交
				form.on('submit(formDemo)', function(data) {
					layer.msg(JSON.stringify(data.field));
					alert("提交完毕可以添加图片")
					$("#uptest2").removeAttr('disabled');
					// document.getElementById("uptest2").disabled=true;
					document.getElementById("uptest2").innerHTML="上传图片2";
					return false;
				});
				
	
				



			});